home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Demos
/
Bowers Development
/
AppMaker 2.0b5
/
Examples
/
Procedural
/
Gadgets
/
Buttons.c
< prev
next >
Wrap
Text File
|
1996-03-19
|
5KB
|
207 lines
/* Buttons.c */
/* Created 01/01/95 12:01 PM by AppMaker */
#include <Types.h>
#include <Quickdraw.h>
#include <Controls.h>
#include <Dialogs.h>
#include <Events.h>
#include <Lists.h>
#include <Menus.h>
#include <Resources.h>
#include <TextEdit.h>
#include <ToolUtils.h>
#include "ResourceDefs.h"
#include "Globals.h"
#include "Miscellany.h"
#include "Scrolling.h"
#include "WindowAids.h"
#include "GadgetsData.h"
#include "Buttons.h"
#define OKButton 1
#define X3DButton 2
#define PictButtonButton 3
#define TitledPictButton 4
#define CheckCheck 5
#define PictCheckCheck 6
#define X3DCheckCheck 7
static void DoOKButton (void);
static void DoX3DButton (void);
static void DoPictButtonButton (void);
static void DoTitledPictButton (void);
/*----------*/
static void DoOKButton ()
{
} /*DoOKButton*/
/*----------*/
static void DoX3DButton ()
{
} /*DoX3DButton*/
/*----------*/
static void DoPictButtonButton ()
{
} /*DoPictButtonButton*/
/*----------*/
static void DoTitledPictButton ()
{
} /*DoTitledPictButton*/
/*----------*/
void OpenButtons (FSSpec* fileSpec,
short fRefNum)
{
WindowPtr newWindow;
Rect bounds;
newWindow = GetWindow (WIND_Buttons);
if (fileSpec->name [0] != 0) {
SetWTitle (newWindow, fileSpec->name);
}
SetPort (newWindow);
SetNewInfo (newWindow);
cur->vScroll = nil;
cur->hScroll = nil;
cur->fileNum = fRefNum;
cur->dirty = false;
cur->filename = NewString (fileSpec->name);
cur->windowKind = WButtons;
((WindowPeek) curWindow)->windowKind = userKind + WButtons;
cur->witlHandle = GetResource ('Witl', WIND_Buttons);
cur->wictHandle = GetResource ('Wict', WIND_Buttons);
cur->OKHandle = GetNewControl (CNTL_OK, newWindow);
cur->X3DHandle = GetNewControl (CNTL_X3D, newWindow);
cur->PictButtonHandle = GetNewControl (CNTL_PictButton, newWindow);
cur->TitledPictHandle = GetNewControl (CNTL_TitledPict, newWindow);
cur->CheckHandle = GetNewControl (CNTL_Check, newWindow);
cur->CheckChecked = false;
cur->PictCheckHandle = GetNewControl (CNTL_PictCheck, newWindow);
cur->PictCheckChecked = false;
cur->X3DCheckHandle = GetNewControl (CNTL_X3DCheck, newWindow);
cur->X3DCheckChecked = false;
cur->text = nil;
ShowWindow (newWindow);
} /*OpenButtons*/
/*----------*/
void CloseButtons (void)
{
DisposHandle ((Handle) cur->filename);
DiscardInfo (curWindow);
} /*CloseButtons*/
/*----------*/
void ControlButtons (ControlHandle whichControl,
short whichPart,
Point where)
{
Rect bounds;
if (whichControl == cur->OKHandle) {
if (TrackButton (cur->OKHandle, where)) {
DoOKButton ();
}
}
if (whichControl == cur->X3DHandle) {
if (TrackButton (cur->X3DHandle, where)) {
DoX3DButton ();
}
}
if (whichControl == cur->PictButtonHandle) {
if (TrackButton (cur->PictButtonHandle, where)) {
DoPictButtonButton ();
}
}
if (whichControl == cur->TitledPictHandle) {
if (TrackButton (cur->TitledPictHandle, where)) {
DoTitledPictButton ();
}
}
if (whichControl == cur->CheckHandle) {
TrackCheck (cur->CheckHandle, where, &cur->CheckChecked);
}
if (whichControl == cur->PictCheckHandle) {
TrackCheck (cur->PictCheckHandle, where, &cur->PictCheckChecked);
}
if (whichControl == cur->X3DCheckHandle) {
TrackCheck (cur->X3DCheckHandle, where, &cur->X3DCheckChecked);
}
} /*ControlButtons*/
/*----------*/
void MouseInButtons (Point where,
short modifiers)
{
Rect bounds;
} /*MouseInButtons*/
/*----------*/
void TypeInButtons (char ch)
{
if (cur->text == nil) {
SysBeep (1);
} else {
TEKey (ch, cur->text);
cur->dirty = true;
}
} /*TypeInButtons*/
/*----------*/
void UpdateButtons (void)
{
Rect bounds;
SetWFont (OKButton);
Draw1Control (cur->OKHandle);
SetWFont (X3DButton);
Draw1Control (cur->X3DHandle);
SetWFont (PictButtonButton);
Draw1Control (cur->PictButtonHandle);
SetWFont (TitledPictButton);
Draw1Control (cur->TitledPictHandle);
SetWFont (CheckCheck);
Draw1Control (cur->CheckHandle);
SetWFont (PictCheckCheck);
Draw1Control (cur->PictCheckHandle);
SetWFont (X3DCheckCheck);
Draw1Control (cur->X3DCheckHandle);
DrawClippedGrow (-15, -15);
} /*UpdateButtons*/
/*----------*/
void ActivateButtons (Boolean activate)
{
DrawClippedGrow (-15, -15);
} /*ActivateButtons*/
/*----------*/
void ResizeButtons (void)
{
/* application-specific code to resize items in window */
} /*ResizeButtons*/
/*----------*/
pascal void ScrollButtons (short newValue,
short oldValue)
{
/* application-specific code to scroll window */
} /*ScrollButtons*/
/* Buttons */